{include file="public/header"}
<div class="page-content">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
        <div class="widget am-cf" style=" height: 500px;">
            <div class="widget-head am-cf">
                <div class="widget-title am-cf">用户列表</div>
            </div>
            <div class="widget-body am-fr">
                <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                    <div class="am-form-group">
                    </div>
                </div>
                <div class="am-u-sm-12">
                    <div>
                        <a class="layui-btn layui-btn-normal" href="add">添加</a>
                    </div>
            	<table class="am-table am-table-compact am-table-striped tpl-table-black " id="dyntable">
                    <thead>
                        <tr>
                            <th class="head0 nosort">
                                <input type="checkbox" class="checkall" />
                            </th>
                            <th class="center">ID</th>
                            <th class="center">用户名</th>
                            <th class="center">地址</th>
                            <th class="center">email</th>
                            <th class="center">联系方式</th>
                            <th class="center">订餐</th>
                            <th  style="width: 60px;text-align: center" colspan="4">操作</th>

                        </tr>
                    </thead>
                    <tbody>
                    	{volist name="udata" id="vo"}
	                   <tr class="gradeX">
	                           <td class="aligncenter">
	                               <span class="center">
	                                    <input type="checkbox" />
	                                </span>
	                           </td>
                                     <td class="am-text-middle">{$vo.id}</td>
	                           <td class="center">{$vo.username}</td>
	                         <td class="am-text-middle">
                                            {empty name="vo.address"}未填写
                                            {else /} {$vo.address}
                                            {/empty}
                                    </td>
	                         <td class="am-text-middle">
                                            {empty name="vo.email"}未填写
                                            {else /} {$vo.email}
                                            {/empty}
                                    </td>
                                    <td class="am-text-middle">
                                            {empty name="vo.phone"}未填写
                                            {else /} {$vo.phone}
                                            {/empty}
                                    </td>
                                    <td class="am-text-middle">
                                        {if condition="($vo.post eq '1')"}允许
                                        {else /}不允许
                                        {/if}
                                    </td>
                           <td class="am-text-middle">
                               <a href="{:url('users/edit',['no'=>$vo.id])}">
                                   <i class="am-icon-pencil"></i>编辑
                               </a>
                           </td>
                           <td style="text-align: center">
                               <a onclick="showDel('{$vo.id}','{$vo.username}')"
                                  class="item-delete tpl-table-black-operation-del">
                                   <i class="am-icon-trash"></i> 删除
                               </a>
                           </td>

	                   </tr>
	               {/volist}
                    </tbody>
                </table>
                    {$udata->render()}
            </div>
        </div>
        
    </div>

</div>
</div>
<script>
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;

    });
    layui.use(['element','layer'], function(){
        var element = element;});

    function showDel(no,name) {
        var layer = layui.layer;
        layer.confirm('确认删除'+name+'？', {
            btn: ['确认', '取消'] //可以无限个按钮
        }, function (index, layero) {
            //按钮【按钮一】的回调
            location.href="{:url('users/del')}"+"?no="+no;
        }, function (index) {
            //按钮【按钮二】的回调
        });
    }
</script>
</body>
</html>
